#pragma once
#include <vector>
#include "Emitter.h"
#include "..\SGD Wrappers\SGD_String.h"
#include "..\SGD Wrappers\SGD_GraphicsManager.h"
#include "..\SGD Wrappers\SGD_InputManager.h"

class ParticleSystem
{
public:
	/**********************************************************/
	// Singleton Accessor
	static ParticleSystem* GetInstance(void);


	struct EmitterData
	{
		int EMmax;
		float EMspawnrate;
		float EMposx;
		float EMposy;
		float EMvelocity;
		int EMloop;
		float EMwidth;
		float EMheight;
		int EMshape;

	};

	struct ParticleData
	{
		float Pvelocityx;
		float Pvelocityy;
		float Plifetimer;
		int Palpha;
		float Pred;
		float Pgreen;
		float Pblue;
		float Protationx;
		float Protationy;
		float Pscalex;
		float Pscaley;


	};

	struct FlyweightData
	{
		char* FWimageID;
		float FWalpha;
		float FWred;
		float FWgreen;
		float FWblue;
		float FWscale;
		float FWrotation;
		float FWvelocity;


	};

	struct ParticleEffect
	{
		//	char*	PEimageID;
		//float	PEmax;
		float	PEalpha1;
		float	PEalpha2;
		int		PEloop;
		int		PEshape;
		float	PEspawnrate;
		float	PEposx;
		float	PEposy;
		float	PEvelocity;
		float	PEwidth1;
		float	PEheight1;
		float	PElifetimer;
		float	PEred1;
		float	PEgreen1;
		float	PEblue1;
		float	PEred2;
		float	PEgreen2;
		float	PEblue2;
		float	PErotation;
		float	PEscaley;
		float	PEscalex;



	};

public:
	SGD::String CreateEmitter(SGD::String);

	bool LoadEmitter(const char* filename);


	void Init();
	void Render();
	void Update(float elapsedTime);
	void CreateParticle();
	void Exit();

protected:
	float myTime;
	typedef std::vector<Emitter> Emitter;

	bool once;
	int count;

	EmitterData EMstats;
	ParticleData PAstats;
	FlyweightData FWstats;
	std::vector<ParticleEffect> PEstats;

	SGD::HTexture m_PShapes;


#define PARTICLESYSTEM ParticleSystem::GetInstance()

};